package com.cedifie.lendapp.ui

import android.os.Handler
import android.os.Looper
import android.view.View
import com.cedifie.lendapp.R
import com.cedifie.lendapp.databinding.ActWelcomeBinding
import com.cedifie.lendapp.http.HttpHelper
import com.cedifie.lendapp.mvp.RestartAct
import com.cedifie.lendapp.ui.loan.act.CedLoanMainAct
import com.cedifie.lendapp.utils.event.CedEventType

/**
 * Cedifie
 * @Author wwdeng
 * @CreateTime: 2024/6/14 19:32
 * @Annotation：
 */
class CedWelcomeAct: RestartAct() {
    lateinit var binding: ActWelcomeBinding
    override fun getCedRootView(): View {
        binding = ActWelcomeBinding.inflate(layoutInflater)
        return binding.root
    }

    override fun initCedView() {
        binding.textWelcome.text = String.format(getString(R.string.tips_welcome),getString(R.string.app_name))
    }

    override fun initCedListener() {
    }

    override fun initCedData() {
        Handler(Looper.getMainLooper()).postDelayed({
            onIntent(CedLoanMainAct::class.java)
            finish()
        },1500)
    }

    override fun onStart() {
        super.onStart()
        HttpHelper.addCedEventAction(CedEventType.PAGE.CED_PAGE_WELCOME_START,"")
    }

    override fun onDestroy() {
        super.onDestroy()
        HttpHelper.addCedEventAction(CedEventType.PAGE.CED_PAGE_WELCOME_END,"")
    }
}